// 引入地址、端口、一级路由
import {
  address,
  pathApi
} from "@/api/path";
// 引入 axios
import axios from "axios";
// 查询消息
const queryMessage = (condition, callback) => {
  axios({
    data: {
      Account: condition.Account,
      userID: condition.userID,
      code: condition.code,
      page:condition.page,
      limit:condition.limit,
    },
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    url: `${address}${pathApi}/ApprovalMessage/findMessage`
    // http://192.168.0.104:9001/chuanxi/ApprovalMessage/findMessage
  }).then(function (res) {
    callback(res.data)
  });
}
// 消息单个标记已读
const setMessage = (condition, callback) => {
  axios({
    data: {
     id:condition,
    },
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    url: `${address}${pathApi}/ApprovalMessage/setMessage`
    
  }).then(function (res) {
    callback(res.data)
  });
}
// 消息全部标记已读
const setAllMessage = (condition, callback) => {
  axios({
    data: {
      userID:condition.userID, // userID用户id 
      datasource:condition.datasource, //  账套名 
    },
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    url: `${address}${pathApi}/ApprovalMessage/updateApprovalMessage`
  }).then(function (res) {
    callback(res.data)
  });
}

export {
  queryMessage,
  setMessage,
  setAllMessage,
}
